<template>
    <div>
        <a-modal
            :visible="visible"
            @cancel="visible = false"
            :footer="null"
        >
            <div v-if="visible">
                <a-tree
                :default-expanded-keys="defaultExpandedKey" @select="onSelect"
                >
                <a-tree-node v-for="(item,index) in treeData" :key="item.title" :title="item.title" :disabled="item.title=='无'?false:true">
                    <a-tree-node v-for="(trem,tI) in item.children" :key="trem.title" :title="trem.title" />
                </a-tree-node>
                </a-tree>
            </div>
        </a-modal>
    </div>
</template>
<script>
import {jcylxdjcjjszcList} from './service/index'
export default {
    components:{

    },
    props:{

    },
    data(){
        return{
            visible:false,
            treeData:[],
            replaceFields: {
                children: 'children',
                title: 'title',
            },
            defaultExpandedKey:[],
        }
    },
    watch:{

    },
    mounted(){
        
    },
    methods:{
        getData(){ 
            this.treeData = []
            jcylxdjcjjszcList().then(res=>{
                if(res.code == 200){
                    res.result.forEach((item,index)=>{
                        this.treeData.push({...item,selectable:false})
                    })
                    // this.treeData = res.result
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        onSelect(key,e){
            // this.$emit('selectIntact',
            // key[0].split('').splice(0, key[0].lastIndexOf('（')).join(''),
            // key[0].split('').splice(key[0].lastIndexOf('（')+1).join('').slice(0, -1))
            if(key.length){
                this.$emit('selectIntact',key[0])
            }
            
        },
        onCheck(){

        },
    }
}
</script>
<style lang="less">
li.ant-tree-treenode-disabled > span:not(.ant-tree-switcher), li.ant-tree-treenode-disabled > .ant-tree-node-content-wrapper, li.ant-tree-treenode-disabled > .ant-tree-node-content-wrapper span{
    color: rgba(0, 0, 0, 0.65);
}
</style>